import openpyxl  
  
wb = openpyxl.Workbook()  
ws = wb.active  
  
ws.cell(row=1, column=1, value="code")  
ws.cell(row=1, column=2, value="character")  
  
for i in range(0x4E00, 0x9FA5):  
    char = chr(i).encode("gb2312")  
    if char == b"\x00":  
        continue  
    ws.cell(row=i//16+2, column=i%16+1, value=i)  
    ws.cell(row=i//16+2, column=i%16+2, value=char)  

wb.save("gb2312_characters.xlsx")